<template>
  <div class="col-sm-12">
    <div class="col-sm-3">
      <button class="btn btn-default col-sm-3 col-lg-offset-1" href="#add" v-on:click="onAdd('modeAddNew')">新增</button>
    </div>
    <!-- <form id="search"> -->
    <div class="col-sm-1 col-sm-offset-7 text-left vertical-middle-sm">
      <h5><strong>
        <a role="button" class="control-label" data-toggle="collapse" href="#advancedsearch" aria-expanded="false"
           aria-controls="advancedsearch">高级...</a>
      </strong></h5>
    </div>
    <!-- </form> -->
  </div>
  <div class="row">
    <div class="col-sm-12">
      <br/>
    </div>
  </div>

  <div class="collapse col-sm-12" id="advancedsearch">
    <div class="well">
      <div class="row">
        <form class="form-horizontal contract-form">
          <div class="form-group">
            <label for="titleSearch" class="col-sm-1 control-label">标题包含</label>

            <div class="col-sm-5">
              <input id="titleSearch" name="titleSearch" type="text" v-model="title" value="2015-01-01" class="form-control"
                     required/>
            </div>
            <label for="contentSearch" class="col-sm-1 ">正文包含</label>

            <div class="col-sm-5">
              <input id="contentSearch" name="contentSearch" type="text" v-model="content" value="2016-02-01"
                     class="form-control" required/>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-1 control-label">日期&nbsp;&nbsp;&nbsp;从</label>

            <div class="col-sm-3">
              <input id="begintime" name="begintime" type="date" v-model="begintime" value="" class="form-control" required/>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-1 control-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;到</label>

            <div class="col-sm-3">
              <input id="endtime" name="endtime" type="date" v-model="endtime" value="" class="form-control" required/>
            </div>
          </div>
          <!-- </form> -->
        </form>
      </div>
    </div>
  </div>
</template>
<script>
  export default{
    mode: 'modeList',
    data: function () {
      return {
        titleSearch: {},
        contentSearch: '',
        begintime: '',
        endtime: ''
      }
    },
    methods: {
      onAdd: function () {
        console.log('setMode: inside component itemsearch')
        this.$dispatch('component', 'modeAddNew')
      },
      onBack: function () {
        this.$dispatch('onback')
      },
      onRemoveSelected: function () {
        var items = this.delitems
        console.log(items)
        var r = window.confirm('确定删除选中任务？')
        if (r === true) {
          for (var i in items) {
            if (items[i].selected) {
              this.$dispatch('deleteitems', items[i])
            }
          }
          this.$dispatch('finditem')
        }
      }
    },
    ready: function () {
    },
    events: {
      'items': function (items) {
        console.log('delete all')
      }
    }
  }
</script>
